package cn.xie.blog.webadmin.web.controller;

import cn.xie.blog.commonutil.response.Response;
import cn.xie.blog.model.common.param.login.LoginParam;
import cn.xie.blog.webadmin.web.service.UserWebService;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

/**
 * @author: xiaoxie
 * create: 2025-04-26 12:28
 * @BelongsProject: blog-parent
 * @BelongsPackage: cn.xie.blog.webadmin.web.controller
 * description:
 */
@RestController
@RequestMapping(value="/web")
@SuppressWarnings({"unchecked", "rawtypes"})
public class UserWebController {
    private static final Logger log = LoggerFactory.getLogger(UserWebController.class);
    @Resource
    private UserWebService userService;
    @PostMapping("/admin/login")
    public Response<String> userLogin(@RequestBody LoginParam loginParam) {
        log.info("管理员开始登录 loginParam{}", loginParam);
        return Response.ok(userService.login(loginParam));
    }
    @GetMapping("/admin/logout")
    public Response<Boolean> logout() {
        return Response.ok(userService.logout());
    }
}
